home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / 4dostool / 4decomp.zip / 4DECOMP.DOC next >
Text File  |  1993-12-12  |  4KB  |  87 lines

  1. 4DECOMP V1.0 (c) 1993 by Akisoft, Vienna
  2.  
  3. 4DOSs New Version 5.0 came up right now! It has a lot of new features,
  4. including BATCOMP.EXE, also from JP Software, which is assumed to compress
  5. .BTM-Files.
  6.  
  7. Its purpose is to make .BTM-files shorter (to use less space on the hard-
  8. disk) and to make .BTM-files something like "encrypted". That makes it
  9. possible for batch-file-programmers to distribute their files without
  10. distributing the batch-file-source-code, which is imanent to distributing
  11. flat batch-files. The encryption algorithm is as simple as the decryption
  12. algorithm. A very short program, with pascal-source-code, can decrypt such
  13. batch-files. The maximum file-length is, like in .BTM-files, limited to 64k.
  14.  
  15. File-format of the compressed file:
  16. ===================================
  17. (like everything in this package distributed without any warranty)
  18.  
  19. The first 2 Bytes are equal to EBh BEh, the indicator for compressed 4DOS-
  20. .BTM-files. the next 2 Bytes contain the size of the original BATCH-file.
  21.  
  22. The encryption (compression) uses the following cheme: from position 5 there
  23. are 30 characters stored, which are the most frequently used characters. The
  24. rest of the file contains nibbles (2 nibbles per byte).The first 14 of the
  25. most frequently used characters have nibble-codes from 2 to 15 (2h to Fh),
  26. the others have 2-nibble-codes (use the same size as one byte, but may be lo-
  27. cated separated inside 2 bytes), the first nibble is always 1 and the second
  28. goes from 0 to 15 (0h to Fh). The nibble code 0 (at a first-level-nibble-
  29. position) is used to indicate that the following 2 nibbles represent one char
  30. in ASCII, but the lower 4 bits swapped with the upper 4 (the 2 nibbles are
  31. swapped). Summary: If there are only a few different chars inside the text,
  32. for example by using a lot of ECHO-directives, the text can be compressed to
  33. one half of its original size (1 char uses only 1 nibble of storage place). If
  34. there are a lot of different characters in the text, and most of them appear
  35. often, it is possible that the "compressed" file is larger than the original
  36. batch-file.
  37.  
  38. A short example:
  39.  
  40. Original .BTM-File:
  41.  
  42. ECHO OFF
  43. echo abcdefghijklmnopqrstuvwxyz
  44.  
  45. Compressed .BTM-File (HEX-output of DEBUG):
  46.  
  47. 0000  EB BE 28 00 20 46 4F 63-65 68 6F 0D 43 45 48 61   ..(. FOceho.CEHa
  48. 0010  62 64 66 67 69 6A 6B 6C-6D 6E 70 71 72 73 74 75   bdfgijklmnpqrstu
  49. 0020  76 77 BA C4 24 33 96 57-82 DE 5F 61 01 17 12 13   vw..$3.W.._a....
  50. 0030  14 15 16 17 81 81 91 A1-B1 C1 D1 E1 F0 87 09 70   ...............p
  51. 0040  A7                                                .
  52.  
  53. *)      0000: EB BE, indicates compressed .BTM-file.
  54. *)      0002: 28 00, size of original .BTM-file (0028h=40 bytes).
  55. *) 0005-0011: The very most frequently used characters, 0dh stands
  56.               for both 0dh and 0ah (carriage return+line feed).
  57. *) 0012-0022: The other most frequently used characters.
  58. *) 0023-0040: Token for the used characters in the original .BTM-file:
  59.               BA = Token bh (Token 11 is "E"), Token ah (Token 10 is "C")
  60.               C4 = Token for "H" and "O"
  61.               24 = Token for " " and "O"
  62.               33 = twice the Token for "F"
  63.               96 = Token for NEW-LINE and "e"
  64.               57 82 DE 5F = Token for "cho abcd"
  65.               61 = Token for "e" and prefix for second table
  66.               01 = Token 0 from second table = "f" + prefix for second table
  67.               17 = Token 1 from second table = "g" + first Token 7 = "h"
  68.               12 13 14 15 16 17 = all token from second table "ijklmn"
  69.               81 = Token "o" + prefix, second table
  70.               81 91 A1 B1 C1 D1 E1 = Token "pqrstuv" from second table
  71.               F0 87 = Token 15 from second table "w" and character 78h="x"
  72.               09 70 A7 = again Token for character, character "y", token, "z"
  73.  
  74. That's it!
  75.  
  76. Use the program as long as JP software doesn't change the encryption
  77. algorithm ...
  78.  
  79. The program, source, documentation is uploaded "as is", without any warranty,
  80. etc. Use, modify, copy, and delete the program excessively the way you want,
  81. but keep in mind, the idea was MINE (pow!)!
  82.  
  83. mfg to all my hacking friends i don't know yet 
  84.  
  85. and "Viele Gruesse aus Oesterreich!"
  86.  
  87. Akisoft, Vienna (c) december 1993